<template>
	<view class="page">
		<view class="flex m-b-30" @click="show=true">
			<view class="bold m-r-30">类型</view>
			<view class="choose" v-if="!typename">请选择</view>
			<view class="choose" v-else>{{typename}}</view>
		</view>
		<u-picker @confirm="confirm" @cancel="show=false" :show="show" :columns="columns" keyName="name"></u-picker>
		<view class="flex m-b-30">
			<view class="bold m-r-30">投诉</view>
			<u--textarea v-model="value1" count placeholder="请输入投诉内容" ></u--textarea>
		</view>
		<view @click="submit" class="m-t-100 bold">
			<u-button shape="circle" size="large" type="primary" text="提交"></u-button>
		</view>
	</view>
</template>

<script>
	const app = getApp();
	export default {
		data() {
			return {
				show: false,
				type:'',
				typename:'',
				columns:[],
				value1:'',
			}
		},
		onLoad() {
			let columns = [app.globalData.fklx]
			this.columns = columns;
			// console.log(columns)
		},
		methods: {
			close(){
				this.show = false;
			},
			confirm(e){
				// console.log('confirm', e.value[0].value)
				this.type = e.value[0].value;
				this.typename = e.value[0].name;
				this.show = false;
			},
			async submit(){
				if (!this.type)
					return this.$toast({
						title: '请选择类型'
					});
				if (!this.value1)
					return this.$toast({
						title: '请输入投诉内容'
					});
				let res = await this.$api.feedback({
					type: this.type,
					content: this.value1,
					images:''
				});
				if (res.code == 1) {
					this.$toast({
						title: '操作成功',
						icon: 1
					});
					setTimeout(function () {
						uni.navigateBack();
					}, 1000);
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
.page{
	padding: 30rpx 35rpx;
	font-size: 30rpx;
	
	.choose{
		padding: 20rpx 35rpx;
		border-radius: 15rpx;
		border: 1px solid #eee;
		flex: 1;
	}
	
}
</style>
